//
//  BusStopCell.m
//  Bus_iPhone
//
//  Created by antunnel on 12-7-2.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "BusStopCell.h"

@interface BusStopCell (Private)

-(void)setViewSelect:(BOOL)selected animated:(BOOL)animated;

@end
@implementation BusStopCell

@synthesize busImgView=_busImgView;
@synthesize stopNameLabel=_stopNameLabel;

-(void)dealloc{

    [_busImgView release];
    [_stopNameLabel release];
    [super dealloc];
}


- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        _busImgView=[[UIImageView alloc]initWithFrame:CGRectMake(10.0f, 5.0f, 40.0f, 40.0f)];
        _busImgView.backgroundColor=[UIColor clearColor];
        [self.contentView addSubview:_busImgView];  
        
        _stopNameLabel=[[UILabel alloc]initWithFrame:CGRectMake(60.0f, 5.0f, self.contentView.frame.size.width-70.0f, 40.0f)];
        _stopNameLabel.autoresizingMask=UIViewAutoresizingFlexibleWidth;
        _stopNameLabel.font=[UIFont boldSystemFontOfSize:17.0f];
        _stopNameLabel.backgroundColor=[UIColor clearColor];
        [self.contentView addSubview:_stopNameLabel];
        
        
        UIImage *pressImg=[UIImage imageNamed:@"buddy_list_press.png"];
        UIImageView *pressView=[[UIImageView alloc]initWithImage:pressImg];
        self.selectedBackgroundView=pressView;
        [pressView release];
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    [self setViewSelect:selected animated:animated];
    // Configure the view for the selected state
}

-(void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated{

    [super setHighlighted:highlighted animated:animated];
    [self setViewSelect:highlighted animated:animated];
}

-(void)setViewSelect:(BOOL)selected animated:(BOOL)animated{

    if (selected) {
        _stopNameLabel.textColor=[UIColor whiteColor];
    }else {
        _stopNameLabel.textColor=[UIColor blackColor];
    }
}
@end
